<template>
	<view class="">
		<view class="py-2" v-for="item of contList" :key="item.id">
			<view class="flex align-center" @click="toColumn(item)" v-if="item.columns_title">
				<view class="round bg_main"></view>
				<text class="font_24 c_6 ml-1">{{ item.columns_title }} ></text>
			</view>
			<view class="flex pt-2" @click="toDetail(item)">
				<view class="img_warp">
					<u--image :src="item.img_path" width="216rpx" height="120rpx" radius="5">
						<u--image width="216rpx" height="120rpx" radius="5" slot="error" :src="'https://images.weserv.nl/?url=' + item.img_path" mode=""></u--image>
					</u--image>
					<view class="tag font-small text-white rounded" v-if="item.label">{{ item.label }}</view>
				</view>
				<view class="flex flex-column justify-between ml-2">
					<view class="h6 lh_30 font-weight-bold">{{ item.title }}</view>
					<view class="c_9 font_22">
						<text v-if="item.source" class="mr-2">{{ item.source }}</text>
						<text>{{ item.add_time }}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import util from '@/common/js/util.js';
import { videoliveHeat } from '@/api/home/video/video.js';
export default {
	props: {
		contList: {
			type: Array,
			default: function() {
				return [];
			}
		},
		isRouter: {
			type: Boolean,
			default: true
		}
	},
	data() {
		return {};
	},
	methods: {
		toDetail(val) {
			// 热度值+1
			videoliveHeat({ id: val.id }).then(res => {
				// console.log("热度值+1", res);
			});
			if (val.type == 1) {
				uni.navigateTo({
					url: '/subPages/home/video/video_detail?id=' + val.id
				});
			} else {
				// this.goPages('/subPages/web_view_h5/index?url=' + encodeURIComponent(val.url) + '&title=' + val.title);
				// 跳转视频号直播
				util.channelsLice(val.start_time, val.end_time);
			}
		},
		toColumn(val) {
			if (!this.isRouter) return;
			this.goPages('/subPages/home/video/column?id=' + val.columns_id);
		}
	}
};
</script>

<style lang="scss" scoped>
.round {
	width: 20rpx;
	height: 20rpx;
	border-radius: 50%;
}

.img_warp {
	position: relative;
	width: 216rpx;
	height: 120rpx;

	.tag {
		position: absolute;
		bottom: 8rpx;
		right: 8rpx;
		padding: 3rpx 15rpx;
		background-color: dimgrey;
	}
}
</style>
